Chris Pollett > Old Classes >
CS174

( Print View )

Student Corner:
  [Grades Sec1]
  [Grades Sec2]
  [Grades Sec3]

  [Submit Sec1]
  [Submit Sec2]
  [Submit Sec3]

  [Class Sign Up Sec1]
  [Class Sign Up Sec2]
  [Class Sign Up Sec3]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












HW#3 --- last modified February 28 2019 23:08:00..

Solution set-ZIP.

Due date: Oct 29

Files to be submitted:
  Hw3.zip

Purpose: To gain experience writing PHP server-side scripts. To learn about REST based web services.

Related Course Outcomes: This homework involves four out five of the course related outcomes listed on the syllabus. The only one not covered is (4).

Specification:

For this homework you are to design a web shopping cart application in PHP. In the real world there are several companies which provide essentially the same type of service that you will be creating. For instance, CartManager. As a first step in creating your shopping cart you need to write a DTD called shopping_cart.dtd for an XML language that could be used to list out each of the items that might be in the shopping cart. Your language should be non-specific enough that it would work for storing different kinds of items an online company might be selling. Example online retailers might include book retailers, sport supplies, computer stores, etc. Put this dtd in your Hw3.zip file when you submit. Also, create a small test document cart.xml. Now let's continue describing the rest of the shopping cart application. Your shopping cart will be located at some URL (the grader will determine the precise URL, you cannot assume it is http://localhost/). It should be a REST application which supports the following method URLs:

URL/create_business/ -- creates a new directory on the server. The name of the directory should be the businessID of the given business. This directory will contain one file for each customer that starts a shopping cart for that business. This REST URL's query string of parameters might look like ?format=xml&businessID=12345&checkString=dsjfhkj. For this transaction to succeed checkString should be the result of applying md5 to the concatenation of the businessID, a secret string stored in the file create_secret.txt on the server, and today's date. Your program's JSON or XML data returned should contain response information about if the transaction succeeded or how it failed.

URL/delete_business/ -- deletes the directory associated with the given businessID. This REST URL's query string of parameters might look like ?format=xml&businessID=12345&checkString=dsjfhkj. For this transaction to succeed checkString should be the result of applying md5 to the concatenation of the businessID, a secret string stored in the file delete_secret.txt on the server, and today's date. Your program's JSON or XML data returned should contain response information about if the transaction succeeded or how it failed.

URL/contents/ -- gets the contents of the shopping cart as either XML or JSON data. This REST URL's query string of parameters might look like ?format=xml&businessID=12345&customerID=54321.

URL/insert/ -- inserts the provided item into the given customerID's shopping cart file in the businessID's directory on the server. This REST URL's query string of parameters might look like ?format=xml&businessID=12345&customerID=54321&itemID=123. Your program's JSON or XML data returned should contain response information about if the transaction succeeded or how it failed.

URL/delete/ -- deletes the provided item from the given customer's shopping cart at the given business. This REST URL's query string of parameters might look like ?format=xml&businessID=12345&customerID=54321&itemID=123. Your program's JSON or XML data returned should be contain response information about if the transaction succeeded or how it failed.

URL/clear/ -- deletes all entries in the given customer's shopping cart at the given business. This REST URL's query string of parameters might look like ?format=xml&businessID=12345&customerID=54321. Your program's JSON or XML data returned should be contain response information about if the transaction succeeded or how it failed.

For the last part of the assignment you should create a set of web pages for a simple business which make use of your shopping cart application. These should test each of the REST methods you have made. You should also have a dummy page with two links on it. The first link calls the create_business method appropriately and the second link calls the delete_business method appropriately.

Your homework files should be submitted in the file Hw3.zip. Be sure to include in this ZIP archive a file readme.txt which lists your group members and explains how to deploy your web application.

Point Breakdown

shoppingcart.dtd and cart.xml as described1pt
PHP scripts which implement /create_business/, /delete_business/, /contents/, /insert/, /delete/, /clear/. (1pt each)6pts
Test business is as described (pages validate as well).2pts
Dummy page as described.1pt
Total10pts